<?php
   
/**
 * Mapper for tstyles
 * 
 * @author Martin Grossmann <snake.aas@gmail.com>
 * @version 1.0
 * @package Mappers
 *
 * @property string $idStyle Name of the style. 30 chars max
 * @property string $Description 
 * 
 * @entity
 * @table(name="tstyles")
 */     
class Style {
  /**
   * style identifier
   * 
   * @access private
   * @var string
   * 
   * @Id
   * @column(name="idStyle", type="string", length=30)
   */
   private $idStyle;
   
   /**
    * Style full name
    * 
    * @var string
    * 
    * @column(name="FullName", type="string", length=30)
    */
   private $fullName;
     
  /**
   * Description
   * 
   * @access private
   * @var string
   * 
   * @column(name="Description", type="string", length=255)
   */
   private $stylesheet;
     
 
  public function __get($name) {

    switch($name) {
      case "idStyle": 
        return $this->idStyle;
        break;
    
      case "FullName":
        return $this->fullName;
        break;
      
      case "Description": 
        return $this->stylesheet;
        break;
      
      default: 
        throw new EntityException(sprintf(T_("Trying to get undefined property")." ", $name));
    }
  }
  
  public function __set($name, $value) {
    
    switch($name) {
      case "idStyle": 
        $this->idStyle = Validations::validateString($value, 30, Validations::regexp_idStyle, false);
        break; 
      
      case "FullName":
        $this->fullName = Validations::validateString($value, 30);

      case "Description": 
        $this->stylesheet = Validations::validateString($value, 255, null, true);
        break; 

      default: 
        throw new EntityException(sprintf(T_("Trying to set undefined property")." ", $name));
    }
  }  
  
  public function __construct() {
    
  }
  
}